package com.ldr.custom.spring.demo.action;

import com.ldr.custom.spring.annotation.GPAutowried;
import com.ldr.custom.spring.annotation.GPController;
import com.ldr.custom.spring.annotation.GPRequestMapping;
import com.ldr.custom.spring.annotation.GPRequestParam;
import com.ldr.custom.spring.demo.service.OrderService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;

@GPController
@GPRequestMapping("/demo")
public class OrderController {

    @GPAutowried
    private OrderService orderService;


    @GPRequestMapping("query")
    public String query(HttpServletRequest request, HttpServletResponse response, @GPRequestParam(value = "id") Integer id) {
        String cookie=request.getHeader("cookie");

        System.out.println(request.getCookies());
        String orderNum = this.orderService.queryById(id);

        return orderNum;
    }

    @GPRequestMapping("querylist")
    public String querylist(@GPRequestParam("ids") Long[] ids){
        List<Long> longs = Arrays.asList(ids);
        return "query result id:"+longs.toString();
    }
}
